//
//  UTBinaryInteger+To.swift
//  iPhoneUTests
//
//  Created by Toj on 1/12/24.
//

import XCTest

final class UTBinaryInteger_To: XCTestCase {

    override func setUpWithError() throws {
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    override func tearDownWithError() throws {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
    }

    func testExample() throws {
        print("-->UTests: start \n")
        
        testToTimeString()
        
        print("-->UTests: end \n")
    }
    
    func testPerformanceExample() throws {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.
        }
    }

}


extension UTBinaryInteger_To {
    
    func testToTimeString() {
        var timeString = ""
        var time = 0
        
        time = 7
        timeString = time.to_timeString("%d秒")
        print("-->UTests: value: time: \(time).to_timeString=\(timeString) ")
        
        time = 41
        timeString = time.to_timeString("%02d秒")
        print("-->UTests: value: time: \(time).to_timeString=\(timeString) ")
        
        time = 61
        timeString = time.to_timeString("%02d分%02d秒")
        print("-->UTests: value: time: \(time).to_timeString=\(timeString) ")
        
        time = 9895
        timeString = time.to_timeString("%d时%02d分%02d秒")
        print("-->UTests: value: time: \(time).to_timeString=\(timeString) ")
        
        time = 98945
        timeString = time.to_timeString("%d天%02d时%02d分%02d秒")
        print("-->UTests: value: time: \(time).to_timeString=\(timeString) ")
        
        print("-->UTests: ---- \n")
        
        time = 98945
        timeString = time.to_timeString_s
        print("-->UTests: value: time: \(time).to_timeString_s=\(timeString) ")
        
        time = 60
        timeString = time.to_timeString_ms
        print("-->UTests: value: time: \(time).to_timeString_ms=\(timeString) ")
        
        time = 9895
        timeString = time.to_timeString_hms
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
        
        print("-->UTests: ---- \n")
        
        time = 98945
        timeString = time.to_timeString(second: "")
        print("-->UTests: value: time: \(time).to_timeString.second=\(timeString) ")
        
        print("-->UTests: ---- \n")
        
        time = 5
        timeString = time.to_timeString(minute: "分", second: "秒")
        print("-->UTests: value: time: \(time).to_timeString.minute.second=\(timeString) ")
        
        time = 60
        timeString = time.to_timeString(minute: ":")
        print("-->UTests: value: time: \(time).to_timeString.minute.second=\(timeString) ")
        
        print("-->UTests: ---- \n")
        
        time = 5
        timeString = time.to_timeString(hour: ":", minute: ":")
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
        
        time = 120
        timeString = time.to_timeString(hour: ":", minute: ":")
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
        
        time = 3600
        timeString = time.to_timeString(hour: ":", minute: ":")
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
        
        time = 7200
        timeString = time.to_timeString(hour: ":", minute: ":")
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
        
        time = 9895
        timeString = time.to_timeString(hour: ":", minute: ":")
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
        
        time = 86400
        timeString = time.to_timeString(hour: ":", minute: ":")
        print("-->UTests: value: time: \(time).to_timeString_hms=\(timeString) ")
    }
}
